<template>
	<view>
		<!-- #ifndef MP-WEIXIN -->
		<my-navbar leftText="返回" @leftClick="leftClick"></my-navbar>
		<!-- #endif -->
		<view class="page flex-center">
			<view class="content">
				<button v-if="showRegist" class="green" type="primary" @click="toNew">
					创建新账号
				</button>
				<button class="white" type="default" @click="toBind">
					绑定已有账号
				</button>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			user_openid: null,
			showRegist: null,
		};
	},
	onLoad(options) {
		this.showRegist = uni.getStorageSync("showRegist") == 2 ? false : true;
		this.user_openid = options.user_openid;
	},
	methods: {
		toNew() {
			uni.navigateTo({
				url: `/pages/account/register?user_openid=${this.user_openid}`,
			});
		},
		toBind() {
			uni.navigateTo({
				url: `/pages/account/bind?user_openid=${this.user_openid}`,
			});
		},
		leftClick() {
			// #ifdef H5
			window.history.back(-1);
			// #endif
			// #ifndef H5
			uni.navigateBack({
				delta: 1,
			});
			// #endif
		},
	},
};
</script>

<style lang="scss">
.page {
	height: 80vh;
	.content {
		.green {
			background: #4fa388;
			margin-bottom: 40rpx;
		}
		.white {
			color: #4fa388;
		}
	}
}
</style>
